load("//bazel:macros.bzl", "exports_files_legacy", "selects", "skia_cc_deps")

licenses(["notice"])

exports_files_legacy()

filegroup(
    name = "srcs",
    testonly = True,
    srcs = [
        "RasterWindowContext_unix.cpp",
        "WindowContextFactory_unix.h",
        "Window_unix.cpp",
        "Window_unix.h",
        "keysym2ucs.c",
        "keysym2ucs.h",
        "main_unix.cpp",
    ] + select({
        "//src/gpu:dawn_backend": ["DawnVulkanWindowContext_unix.cpp"],
        "//src/gpu:gl_backend": ["GLWindowContext_unix.cpp"],
        "//src/gpu:vulkan_backend": ["VulkanWindowContext_unix.cpp"],
        "//conditions:default": [],
    }),
    visibility = ["//tools/sk_app:__pkg__"],
)

selects.config_setting_group(
    name = "dawn_or_vulkan",
    match_any = [
        "//src/gpu:dawn_backend",
        "//src/gpu:vulkan_backend",
    ],
)

skia_cc_deps(
    name = "deps",
    testonly = True,
    linkopts = [
        "-lX11",
        "-lxcb",  # dep of X11
        "-lXau",  # dep of xcb
        "-lXdmcp",  # dep of xcb
    ] + select({
        ":dawn_or_vulkan": ["-lX11-xcb"],
        "//conditions:default": [],
    }),
    visibility = ["//tools/sk_app:__pkg__"],
    deps = select({
        ":dawn_or_vulkan": ["//tools/gpu/vk:testutils"],
        "//conditions:default": [],
    }),
)
